﻿using System;
using System.Threading.Tasks;
using System.Web.Http;
using Abp.Authorization;
using Abp.Authorization.Users;
using Abp.Web.Models;
using Microsoft.Owin.Infrastructure;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.OAuth;
using LeadThing.AbpZeroTemplate.Authorization;
using LeadThing.AbpZeroTemplate.Authorization.Users;
using LeadThing.AbpZeroTemplate.MultiTenancy;
using LeadThing.AbpZeroTemplate.WebApi.Models;
using System.Web;
using LeadThing.AbpZeroTemplate.Files.Dtos;
using System.IO;
using LeadThing.AbpZeroTemplate.Files;
using Abp.Runtime.Session;
using LeadThing.AbpZeroTemplate.Authorization.Users.Dto;

namespace LeadThing.AbpZeroTemplate.WebApi.Controllers
{
    public class UserController : AbpZeroTemplateApiControllerBase
    {
        private readonly IUserAppService _userAppService;

        public UserController(IUserAppService userAppService)
        {
            _userAppService = userAppService;
        }

        /// <summary>
        /// 用户注册（群众）
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<AjaxResult> UserRegister(UserRegisterAPPDto input)
        {
            AjaxResult result = new AjaxResult();
            ErrorInfo error = new ErrorInfo();
            var model = await _userAppService.CreateUserAPPAsync(input);
            result.Success = model.Success;
            error.Message = model.Message;
            result.Error = error;
            return result;
        }

    }
}
